# 题目五 - 1 : 使用SIFT检测角点
import cv2 as cv
import numpy as np

# 读取图像
filename = r"D:\AI\Picture\left03.jpg"
img1 = cv.imread(filename)
# 90度旋转图像
img2 = np.rot90(img1)

# 创建检测算子,提取描述子
surf = cv.xfeatures2d.SURF_create(100)
k1, dst1 = surf.detectAndCompute(img1, None)
k2, dst2 = surf.detectAndCompute(img2, None)

# BFMatcher类对象的创建,描述子匹配
BF = cv.BFMatcher(cv.NORM_L1)
matches = BF.match(dst1, dst2)

# 画出100个描述子匹配点
img3 = cv.drawMatches(img1, k1, img2, k2, matches[:100], None, flags=2)
cv.imshow("SIFT", img3)

cv.waitKey()
cv.destroyAllWindows()



















